package com.yunhe.service;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.yun.dao.checkUserIn;
import com.yunhe.bean.ShopUser;
import com.yunhe.bean.area;
import com.yunhe.util.MySession;

public class checkUserService {
	//check登录
		public List<ShopUser> checklogin(ShopUser shopUser){			
			SqlSession se = new MySession().getSession();
			checkUserIn mapper = se.getMapper(checkUserIn.class);
			List<ShopUser> checkname = mapper.checkname(shopUser);
				return checkname;	
		}
		// 重名检测
		public boolean checkname1(ShopUser shopUser){
			SqlSession se = new MySession().getSession();
			checkUserIn mapper = se.getMapper(checkUserIn.class);
			List<ShopUser> checkname = mapper.checkname1(shopUser);
			if(checkname.size()>0){
				return true;
			}else{
				return false;
			}
			
		}
		//guojia	
		public List<area> selectProv(){
			SqlSession se = new MySession().getSession();
			checkUserIn mapper = se.getMapper(checkUserIn.class);
			List<area> selectproc = mapper.selectproc();
			return selectproc;
		}
		//sheng
		public List<area> selectProv1(int i){
			SqlSession se = new MySession().getSession();
			checkUserIn mapper = se.getMapper(checkUserIn.class);
			List<area> selectproc = mapper.selectproc1(i);
			return selectproc;
		}
		public int InsertUser(ShopUser shopUser){
			SqlSession se = new MySession().getSession();
			checkUserIn mapper = se.getMapper(checkUserIn.class);
			int ins = mapper.insertUser(shopUser);
			if(ins>0){
				se.commit();
				return 1;
			}
			else{
				return 0;
			}
			
		}
}
